﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Yuebon.Car.IServices;
using Yuebon.Car.Models;
using Yuebon.Commons;
using Yuebon.Commons.IoC;

namespace Yuebon.Car.Application
{
    public class AutoBrandApp
    {
        IAutoBrandService service = IoCContainer.Resolve<IAutoBrandService>();
        /// <summary>
        /// 获取被置顶的汽车品牌
        /// </summary>
        /// <returns></returns>
        public List<AutoBrandDto> FindAutoBrandListByIsTop()
        {
            string where = "IsTop=1";
            List<AutoBrand> list = service.GetAllByIsNotDeleteAndEnabledMark(where).OrderBy(t => t.SortCode).ToList();
            List<AutoBrandDto> resultList = new List<AutoBrandDto>();
            foreach (AutoBrand info in list)
            {
                AutoBrandDto autoBrand = new AutoBrandDto();
                autoBrand.Title = info.Title;
                autoBrand.CompanyId = info.CompanyId;
                autoBrand.CreatorTime = info.CreatorTime;
                autoBrand.CreatorUserId = info.CreatorUserId;
                autoBrand.DeleteMark = info.DeleteMark;
                autoBrand.DeleteTime = info.DeleteTime;
                autoBrand.DeleteUserId = info.DeleteUserId;
                autoBrand.DeptId = info.DeptId;
                autoBrand.Description = info.Description;
                autoBrand.EnabledMark = info.EnabledMark;
                autoBrand.Id = info.Id;
                autoBrand.LastModifyTime = info.LastModifyTime;
                autoBrand.LastModifyUserId = info.LastModifyUserId;
                autoBrand.LinkUrl = info.LinkUrl;
                autoBrand.SeoDescription = info.SeoDescription;
                autoBrand.SeoKeywords = info.SeoKeywords;
                autoBrand.SeoTitle = info.SeoTitle;
                autoBrand.SortCode = info.SortCode;
                autoBrand.ImgUrl =info.ImgUrl;
                resultList.Add(autoBrand);
            }
            return resultList;
        }
    }
}
